package org.grow.common.controller;

import org.grow.common.service.IDCodeGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: xwg
 * @CreateDate: 2022/2/11
 */

@RestController
@RequestMapping("/common-service/code")
public class IDCodeController {
    @Resource
    private ThreadLocal<IDCodeGenerator> idCodeGeneratorThreadLocal;

    @GetMapping("/for/auth")
    public String forAuth() {
        String au = idCodeGeneratorThreadLocal.get().nextStaffCode();
        return au;
    }

    @GetMapping("/for/instockBill")
    public String forIn() {
        String au = idCodeGeneratorThreadLocal.get().nextCode("IN");
        return au;
    }
}
